import { MediaMessageContent  } from "wukongimjssdk";
const code = 4;
export class MsgVideoContent extends MediaMessageContent  {
  url!: string; // 视频链接
  title!: string; // 视频标题
  poster!: string; // 首针图片
  trackUrl!: string; // 字母链接


  constructor() {
    super();
    this.contentType = code;
  }

  // 解码
  decodeJSON(content: any) {
    this.url = content["url"];
    this.title = content["title"];
    this.poster = content["poster"];
    this.trackUrl = content["trackUrl"];
  }
  // 编码
  encodeJSON() {
    // console.log("encodeJSON >>", this.url, this.duration, this);
    return {
      url: this.url,
      title: this.title,
      poster: this.poster,
      trackUrl: this.trackUrl
    };
  }
}

export default {
  // 消息类型名称
  name: "msg-video",
  // 消息类型编码
  code: code,
  // 消息类型内容
  content: MsgVideoContent,
};
